﻿using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Operations;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;

namespace PC.PickleJar.VisualStudioIntegration.SmartTagging
{
	[Export(typeof(IViewTaggerProvider))]
	[ContentType("code")]
	[Order(Before = "default")]
	[TagType(typeof(SmartTag))]
	internal class TimestampSmartTaggerProvider : IViewTaggerProvider
	{
		public ITagger<T> CreateTagger<T>(ITextView textView, ITextBuffer buffer) where T : ITag
		{
			ITagger<T> result = null;

			if (buffer == null || textView == null)
			{
				return null;
			}

			// make sure we are tagging only the top buffer 
			if (buffer == textView.TextBuffer)
			{
				result = new TimestampSmartTagger(buffer, textView, this) as ITagger<T>;
			}

			return result;
		}

		[Import(typeof(ITextStructureNavigatorSelectorService))]
		internal ITextStructureNavigatorSelectorService NavigatorService
		{
			get;
			set;
		}
	}
}
